Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump curve25519-dalek from 3.2.1 to 4.1.3 #2252

Merged
merged 7 commits into from
Sep 3, 2024

Conversation

yihau
Copy link
Member

@yihau yihau commented Jul 23, 2024

Problem

we did this bump in #1693, but it seems like we have some concerns that broke the semver convention. I revered it in #2055.

Summary of Changes

try to bump it again

Copy link

@samkim-crypto samkim-crypto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yihau Can you take a look at the suggested changes? It seems like we just need to bump-up the opt-level for the curve25519 crate and all the tests should go through (#2683).

.github/scripts/downstream-project-spl-common.sh Outdated Show resolved Hide resolved
.github/scripts/downstream-project-spl-common.sh Outdated Show resolved Hide resolved
Cargo.toml Show resolved Hide resolved
@yihau yihau marked this pull request as ready for review August 30, 2024 05:00
@yihau
Copy link
Member Author

yihau commented Aug 30, 2024

thank you @samkim-crypto. it looks good!

@yihau yihau requested a review from samkim-crypto August 30, 2024 05:01
@yihau yihau added the v2.0 Backport to v2.0 branch label Aug 30, 2024
Copy link

mergify bot commented Aug 30, 2024

Backports to the beta branch are to be avoided unless absolutely necessary for fixing bugs, security issues, and perf regressions. Changes intended for backport should be structured such that a minimum effective diff can be committed separately from any refactoring, plumbing, cleanup, etc that are not strictly necessary to achieve the goal. Any of the latter should go only into master and ride the normal stabilization schedule. Exceptions include CI/metrics changes, CLI improvements and documentation updates on a case by case basis.

samkim-crypto
samkim-crypto previously approved these changes Aug 30, 2024
Copy link

@samkim-crypto samkim-crypto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it looks good to me! Let's just double check with @joncinque and @ilya-bobyr before merging.

Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Just a couple of comments to clarify things.

It is a bit annoying to have to use the profile override, since downstream devs will need to do the same thing in their workspace, but I can't come up with a better solution.

Comment on lines 28 to 29
echo "[profile.dev.package.curve25519-dalek]
opt-level = 3" >> Cargo.toml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than overriding this, let's wait for solana-labs/solana-program-library#7220 to land

Copy link
Member Author

@yihau yihau Sep 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure! looks like it has been merged and removed the hack f1d4168 🫡

Comment on lines +546 to +547
[profile.dev.package.curve25519-dalek]
opt-level = 3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you give more of an explanation about why this is added? I suggested this language in the SPL PR, but feel free to improve or clarify it:

curve25519-dalek uses the simd backend by default in v4 if possible, which has very slow performance on some platforms with opt-level 0, which is the default for dev and test builds. This slowdown causes certain interactions in the solana-test-validator, such as verifying ZK proofs in transactions, to take much more than 400ms, creating problems in the testing environment.
To enable better performance in solana-test-validator during tests and dev builds, we override the opt-level to 3 for the crate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added! 7ba52fa

Copy link

@joncinque joncinque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, thanks!

@yihau yihau merged commit 6e23e69 into anza-xyz:master Sep 3, 2024
53 checks passed
@yihau yihau deleted the bump-curve25519 branch September 3, 2024 09:57
mergify bot pushed a commit that referenced this pull request Sep 3, 2024
* bump curve25519-dalek from 3.2.1 to 4.1.3

* Update .github/scripts/downstream-project-spl-common.sh

Co-authored-by: samkim-crypto <[email protected]>

* Update .github/scripts/downstream-project-spl-common.sh

Co-authored-by: samkim-crypto <[email protected]>

* Update .github/scripts/downstream-project-spl-common.sh

Co-authored-by: samkim-crypto <[email protected]>

* Update Cargo.toml

Co-authored-by: samkim-crypto <[email protected]>

* remove opt level hack

* add comment for opt level

---------

Co-authored-by: samkim-crypto <[email protected]>
(cherry picked from commit 6e23e69)

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	programs/sbf/Cargo.lock
@andrewkmin
Copy link

Hey all, thanks for merging this in. Just for the sake of estimation, any idea as to when it might get released? Thanks!

yihau added a commit that referenced this pull request Sep 4, 2024
* bump curve25519-dalek from 3.2.1 to 4.1.3

* Update .github/scripts/downstream-project-spl-common.sh

Co-authored-by: samkim-crypto <[email protected]>

* Update .github/scripts/downstream-project-spl-common.sh

Co-authored-by: samkim-crypto <[email protected]>

* Update .github/scripts/downstream-project-spl-common.sh

Co-authored-by: samkim-crypto <[email protected]>

* Update Cargo.toml

Co-authored-by: samkim-crypto <[email protected]>

* remove opt level hack

* add comment for opt level

---------

Co-authored-by: samkim-crypto <[email protected]>
(cherry picked from commit 6e23e69)

# Conflicts:
#	Cargo.lock
#	Cargo.toml
#	programs/sbf/Cargo.lock
@Tenari
Copy link

Tenari commented Sep 5, 2024

ok, but this same issue causes the same problem on the solana-client crate.

@Tenari
Copy link

Tenari commented Sep 5, 2024

for reference what I talking about re: the solana-client dependency:

tenari@dzs-MacBook-Pro api % cargo build
    Updating crates.io index
    Updating git repository `https://github.com/anza-xyz/agave.git`
error: failed to select a version for `zeroize`.
    ... required by package `curve25519-dalek v3.2.1`
    ... which satisfies dependency `curve25519-dalek = "^3.2.1"` of package `solana-program v2.0.0`
    ... which satisfies dependency `solana-program = "^2.0.0"` of package `spl-pod v0.3.0`
    ... which satisfies dependency `spl-pod = "^0.3.0"` of package `spl-token-2022 v4.0.0`
    ... which satisfies dependency `spl-token-2022 = "=4.0.0"` of package `solana-account-decoder v2.1.0 (https://github.com/anza-xyz/agave.git?rev=6e23e69f092fa98cdf172c21e30b244ff1e4bfdf#6e23e69f)`
    ... which satisfies git dependency `solana-account-decoder` of package `solana-pubsub-client v2.1.0 (https://github.com/anza-xyz/agave.git?rev=6e23e69f092fa98cdf172c21e30b244ff1e4bfdf#6e23e69f)`
    ... which satisfies git dependency `solana-pubsub-client` of package `solana-client v2.1.0 (https://github.com/anza-xyz/agave.git?rev=6e23e69f092fa98cdf172c21e30b244ff1e4bfdf#6e23e69f)`
    ... which satisfies git dependency `solana-client` of package `memedeck_api v0.1.0 (/Users/tenari/code/memedeck-monorepo/backend/api)`
versions that meet the requirements `>=1, <1.4` are: 1.3.0, 1.2.0, 1.1.1, 1.1.0, 1.0.0

all possible versions conflict with previously selected packages.

  previously selected package `zeroize v1.7.0`
    ... which satisfies dependency `zeroize = "^1.6"` of package `ruint v1.12.3`
    ... which satisfies dependency `ruint = "^1.12.3"` of package `alloy-primitives v0.7.6`
    ... which satisfies dependency `alloy-primitives = "^0.7.6"` of package `alloy-consensus v0.1.2 (https://github.com/alloy-rs/alloy?tag=v0.1.2#68639726)`
    ... which satisfies git dependency `alloy-consensus` (locked to 0.1.2) of package `alloy v0.1.2 (https://github.com/alloy-rs/alloy?tag=v0.1.2#68639726)`
    ... which satisfies git dependency `alloy` (locked to 0.1.2) of package `generation_api v0.1.0 (/Users/tenari/code/memedeck-monorepo/backend/generation_api)`

failed to select a version for `zeroize` which could resolve this conflict

I get that when I have the following two lines in my Cargo.toml:

solana-sdk = { git = "https://github.com/anza-xyz/agave.git", rev = "6e23e69f092fa98cdf172c21e30b244ff1e4bfdf"  }
solana-client = { git = "https://github.com/anza-xyz/agave.git", rev = "6e23e69f092fa98cdf172c21e30b244ff1e4bfdf"  }

but when I remove the solana-client I no longer get the version error on running cargo build

ray-kast pushed a commit to abklabs/agave that referenced this pull request Nov 27, 2024
* bump curve25519-dalek from 3.2.1 to 4.1.3

* Update .github/scripts/downstream-project-spl-common.sh

Co-authored-by: samkim-crypto <[email protected]>

* Update .github/scripts/downstream-project-spl-common.sh

Co-authored-by: samkim-crypto <[email protected]>

* Update .github/scripts/downstream-project-spl-common.sh

Co-authored-by: samkim-crypto <[email protected]>

* Update Cargo.toml

Co-authored-by: samkim-crypto <[email protected]>

* remove opt level hack

* add comment for opt level

---------

Co-authored-by: samkim-crypto <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2.0 Backport to v2.0 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants